/*
 * employeeBO.java
 *
 * Created on March 17, 2007, 2:14 PM
 *
 */

package edu.byu.isys413.mystuff;

/**
 *
 * @author Sam Griffiths
 */
public class employeeBO {
    
    //initialize variables (employee attributes)
    private String empid;
    private String fName;
    private String lName;
    private String hireDate;
    private String phone;
    private double salary;
    private String storeID;
    private boolean dirty = false;   
    private boolean alreadyInDatabase = false;
    
    /** Creates a new instance of employeeBO */
    public employeeBO() {
    }
        
    //creates new employee bo with id initialized
    public employeeBO(String empid) {
    this.empid = empid;
    }
    
    //returns Employee's id'
    public String getEmpId() {
        return empid;
    }

    //returns Employee's first name'
    public String getFirstName() {
        return fName;
    }

    //Sets Emplolyees first name
    public void setFirstName(String fName) {
        this.fName = fName;
        setDirty(true);
    }

    //returns Employees last Name
    public String getLastName() {
        return lName;
    }

    //sets employees last name
    public void setLastName(String lName) {
        this.lName = lName;
        setDirty(true);
    }

    //returns the date an employee was retired
    public String getHireDate(){
        return hireDate;
    }
    
    //sets the date an employee was hired
    public void setHireDate(String hireDate){
        this.hireDate = hireDate;
        setDirty(true);
    }
    
    //returns an employees telephone number
    public String getPhone() {
        return phone;
    }

    //sets an employees phonenumber
    public void setPhone(String phone) {
        this.phone = phone;
        setDirty(true);
    }
    
    //returns an employees salary (look closely could be annual or by hour)
    public double getSalary(){
        return salary;
    }
    
    //sets an employees salary
    public void setSalary(double salary){
        this.salary = salary;
        setDirty(true);
    }
    
    //returns the id of a store object
    public String getStoreid(){
        return storeID;
    }
    
    //sets this objects storeid reference
    public void setStoreId(String storeID){
        this.storeID = storeID;
        setDirty(true);
    }
    
    //converts employee object into a readable string
    public String toString(){
        return "Employee id  : "+ this.getEmpId()+" \n"+
               "First Name   : "+ this.getFirstName()+" \n"+
               "Last Name    : "+ this.getLastName() +" \n"+
               "Hire Date    : " + this.getHireDate() +" \n"+
               "Phone        : "+ this.getPhone() +" \n"+
               "Salary       : "+ this.getSalary() +" \n"+
               "Store        : "+ this.getStoreid()+" \n";
    }

    //returns if object has been changed since read or saved to or from database
    public boolean isDirty() {
        return dirty;
    }

    //sets clean or dirty
    public void setDirty(boolean dirty) {
        this.dirty = dirty;
    }

    //returns if object is already in database
    public boolean isAlreadyInDatabase() {
        return alreadyInDatabase;
    }

    //sets if object is already in database
    public void setAlreadyInDatabase(boolean alreadyInDatabase) {
        this.alreadyInDatabase = alreadyInDatabase;
    }
}